<?php

/**
 * Paciente form base class.
 *
 * @method Paciente getObject() Returns the current form's model object
 *
 * @package    asindo
 * @subpackage form
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePacienteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'sociedad_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Sociedad'), 'add_empty' => false)),
      'pediatra_habitual_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'add_empty' => true)),
      'nombre'               => new sfWidgetFormInputText(),
      'apellido1'            => new sfWidgetFormInputText(),
      'apellido2'            => new sfWidgetFormInputText(),
      'fecha_nacimiento'     => new sfWidgetFormDate(),
      'orden_hermanos'       => new sfWidgetFormInputText(),
      'sexo'                 => new sfWidgetFormInputText(),
      'alarmas'              => new sfWidgetFormTextarea(),
      'fecha_alta'           => new sfWidgetFormDate(),
      'tipo_via'             => new sfWidgetFormInputText(),
      'via'                  => new sfWidgetFormInputText(),
      'cp'                   => new sfWidgetFormInputText(),
      'numero'               => new sfWidgetFormInputText(),
      'piso'                 => new sfWidgetFormInputText(),
      'letra'                => new sfWidgetFormInputText(),
      'poblacion'            => new sfWidgetFormInputText(),
      'provincia'            => new sfWidgetFormInputText(),
      'email'                => new sfWidgetFormInputText(),
      'telefono1'            => new sfWidgetFormInputText(),
      'telefono2'            => new sfWidgetFormInputText(),
      'telefono3'            => new sfWidgetFormInputText(),
      'observaciones'        => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'sociedad_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Sociedad'))),
      'pediatra_habitual_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'required' => false)),
      'nombre'               => new sfValidatorString(array('max_length' => 255)),
      'apellido1'            => new sfValidatorString(array('max_length' => 255)),
      'apellido2'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'fecha_nacimiento'     => new sfValidatorDate(),
      'orden_hermanos'       => new sfValidatorInteger(array('required' => false)),
      'sexo'                 => new sfValidatorString(array('max_length' => 1, 'required' => false)),
      'alarmas'              => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
      'fecha_alta'           => new sfValidatorDate(array('required' => false)),
      'tipo_via'             => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'via'                  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'cp'                   => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'numero'               => new sfValidatorInteger(array('required' => false)),
      'piso'                 => new sfValidatorInteger(array('required' => false)),
      'letra'                => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'poblacion'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'provincia'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'email'                => new sfValidatorEmail(array('max_length' => 100, 'required' => false)),
      'telefono1'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono2'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telefono3'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'observaciones'        => new sfValidatorString(array('max_length' => 1000, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('paciente[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Paciente';
  }

}
